package defpackage; import cn.wps.core.runtime.Platform; import cn.wps.show.app.KmoPresentation; import com.mopub.mobileads.VastExtensionXmlManager; import defpackage.tvq; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; /* renamed from: usf reason: default package */ public final class usf { /* JADX WARNING: Removed duplicated region for block: B:157:0x056b */ public static synchronized void a(KmoPresentation kmoPresentation, String str, tpd tpd) throws IOException { clr clr; FileInputStream fileInputStream; clq apJ; String str2; synchronized (usf.class) { String lowerCase = lwv.IP(str).toLowerCase(); File fjX = tiq.fjX(); try { String absolutePath = fjX.getAbsolutePath(); uum uum = new uum(tpd, kmoPresentation); try { clr = new clr(absolutePath); try { utp utp = new utp(kmoPresentation, uul.a(clr, lowerCase)); uuj.initialize(); uuk.initialize(); uub.ucj = new HashMap(); uub.vMF = new HashMap(); uub.vMC = 0; uub.vMD = 0; uub.vME = 0; uts.initialize(); utt.vMt = 0; utw.index = 0; col col = new col(uul.a(utp.ckx)); col.startDocument(); col.N("p", "presentation"); col.M("p", "http://schemas.openxmlformats.org/presentationml/2006/main"); col.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); if (utp.vHl.ftv()) { col.i("autoCompressPictures", utp.vHl.ftu()); } if (utp.vHl.ftx()) { col.r("bookmarkIdSeed", utp.vHl.ftw()); } if (utp.vHl.ftz()) { col.i("compatMode", utp.vHl.fty()); } if (utp.vHl.ftB()) { col.J("conformance", uun.vLa.get(Integer.valueOf(utp.vHl.ftA()))); } if (utp.vHl.ftD()) { col.i("embedTrueTypeFonts", utp.vHl.ftC()); } if (utp.vHl.ftF()) { col.r("firstSlideNum", utp.vHl.ftE()); } if (utp.vHl.ftH()) { col.i("removePersonalInfoOnSave", utp.vHl.ftG()); } if (utp.vHl.Zy()) { col.i("rtl", utp.vHl.isRightToLeft()); } if (utp.vHl.ftJ()) { col.i("saveSubsetFonts", utp.vHl.ftI()); } if (utp.vHl.ftL()) { col.r("serverZoom", (int) utp.vHl.ftK()); } if (utp.vHl.ftN()) { col.i("showSpecialPlsOnTitleSld", utp.vHl.ftM()); } if (utp.vHl.ftP()) { col.i("strictFirstAndLastChars", utp.vHl.ftO()); } utp.x(col); if (utp.kVG.uTj != null) { clt a = utp.ckw.a(ckw.chn, 1); col.N("p", "notesMasterIdLst"); col.N("p", "notesMasterId"); col.h("r", "id", a.ckE); col.O("p", "notesMasterId"); col.O("p", "notesMasterIdLst"); } if (utp.kVG.uTh != null) { clt a2 = utp.ckw.a(ckw.chm, 1); col.N("p", "handoutMasterIdLst"); col.N("p", "handoutMasterId"); col.h("r", "id", a2.ckE); col.O("p", "handoutMasterId"); col.O("p", "handoutMasterIdLst"); } utp.y(col); tvq.i fod = utp.vHl.fod(); col.N("p", "sldSz"); if (fod.iD()) { col.J(VastExtensionXmlManager.TYPE, uun.vFv.get(Integer.valueOf(fod.type()))); } col.r("cy", fod.JV()); col.r("cx", fod.JU()); col.O("p", "sldSz"); bba.a(col, utp.vHl.fua(), "p", "notesSz"); utp.A(col); utp.z(col); if (utp.vHl.fue()) { tvq.h fud = utp.vHl.fud(); col.N("p", "photoAlbum"); if (fud.wW()) { col.i("bw", fud.wV()); } if (fud.fuJ()) { col.i("showCaptions", fud.fuI()); } if (fud.oA()) { col.J("layout", uun.vLT.get(Integer.valueOf(fud.fuK()))); } if (fud.fuM()) { col.J("frame", uun.vLS.get(Integer.valueOf(fud.fuL()))); } col.O("p", "photoAlbum"); } if (utp.vHl.ftX()) { tvq.f ftW = utp.vHl.ftW(); col.N("p", "kinsoku"); if (ftW.tH()) { col.J("lang", ftW.tG()); } col.J("invalStChars", ftW.fuy()); col.J("invalEndChars", ftW.fuw()); col.O("p", "kinsoku"); } if (utp.vHl.ftT()) { new bbf(utp.vHl.ftS(), "p", "defaultTextStyle", utp.brv).a(col); } if (utp.kVG.uTu.bub()) { bcl bcl = utp.kVG.uTu.uUo; col.N("p", "modifyVerifier"); col.r("cryptAlgorithmSid", bcl.bsY); col.J("hashData", bcl.bsW); col.J("saltData", bcl.bsX); col.r("spinCount", bcl.bsL); col.J("cryptProviderType", "rsaAES"); col.J("cryptAlgorithmClass", "hash"); col.J("cryptAlgorithmType", "typeAny"); col.J("cryptProvider", ""); col.r("algIdExt", 0); col.J("algIdExtSource", ""); col.r("cryptProviderTypeExt", 0); col.J("cryptProviderTypeExtSource", ""); col.O("p", "modifyVerifier"); } col.O("p", "presentation"); col.endDocument(); utp.fPe(); tqw tqw = utp.kVG.uTj; if (tqw != null) { uuc uuc = new uuc(tqw, utp.ckw.b(ckw.chn, 1).apL()); if (!(uuc.vMG == null || uuc.vMH == null)) { uui uui = new uui(uuc.uWr, uuc.vMH.apK()); cls cls = uuc.vMH; tqw tqw2 = uuc.vMG; col col2 = new col(uul.a(cls)); col2.startDocument(); col2.N("p", "notesMaster"); col2.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); col2.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col2.M("p", "http://schemas.openxmlformats.org/presentationml/2006/main"); twc R = twc.R(tqw2.Jy()); new usp(tqw2.uVV, uuc.uWr.uTy.IR(), uui).a(col2); uso.a(col2, R.fwZ(), "p", "clrMap"); if (R.xj()) { usr.a(col2, R.fqL()); } if (R.fxd()) { new bbf(R.fxc(), "p", "notesStyle", uui).a(col2); } col2.O("p", "notesMaster"); col2.endDocument(); uui.nq(); tsn fqe = uuc.vMG.fqe(); if (fqe == null) { fqe = urj.fOW(); } if (fqe != null) { new uuk(uuc.uWr, uuc.vMH, fqe).fPj(); } } } tqu tqu = utp.kVG.uTh; if (tqu != null) { utz utz = new utz(tqu, utp.ckw.b(ckw.chm, 1).apL()); if (!(utz.vMy == null || utz.vMz == null)) { uui uui2 = new uui(utz.uWr, utz.vMz.apK()); cls cls2 = utz.vMz; tqu tqu2 = utz.vMy; col col3 = new col(uul.a(cls2)); col3.startDocument(); col3.N("p", "handoutMaster"); col3.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); col3.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col3.M("p", "http://schemas.openxmlformats.org/presentationml/2006/main"); twb Q = twb.Q(tqu2.Jy()); new usp(tqu2.uVV, utz.uWr.uTy.IR(), uui2).a(col3); uso.a(col3, Q.fwZ(), "p", "clrMap"); if (Q.xj()) { usr.a(col3, Q.fqL()); } col3.O("p", "handoutMaster"); col3.endDocument(); uui2.nq(); tsn fqe2 = utz.vMy.fqe(); if (fqe2 != null) { new uuk(utz.uWr, utz.vMz, fqe2).fPj(); } } } utp.a(uum); new utq(utp.kVG, uul.c(utp.ckx)).np(); uto uto = new uto(utp.kVG, uul.b(utp.ckx)); if (uto.ckF != null) { uto.vbB = tvq.P(uto.kVG.Jy()).fuj(); col col4 = new col(uul.a(uto.ckF)); col4.startDocument(); col4.N("p", "presentationPr"); col4.M("p", "http://schemas.openxmlformats.org/presentationml/2006/main"); col4.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col4.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); if (uto.vbB.fxD()) { twh fxC = uto.vbB.fxC(); col4.N("p", "prnPr"); if (fxC.fxM()) { col4.J("prnWhat", uun.vLY.get(Integer.valueOf(fxC.fxL()))); } if (fxC.fxH()) { col4.J("clrMode", uun.vLZ.get(Integer.valueOf(fxC.fxG()))); } if (fxC.fvP()) { col4.i("hiddenSlides", fxC.fxK()); } if (fxC.fxO()) { col4.i("scaleToFitPaper", fxC.fxK()); } if (fxC.fxJ()) { col4.i("frameSlides", fxC.fxI()); } col4.O("p", "prnPr"); } if (uto.vbB.fxF()) { twi fxE = uto.vbB.fxE(); col4.N("p", "showPr"); if (fxE.fxQ()) { switch (fxE.fxP().type()) { case 0: col4.N("p", "present"); col4.O("p", "present"); break; case 1: col4.N("p", "browse"); if (fxE.fxP().fye()) { col4.i("showScrollbar", fxE.fxP().fyd()); } col4.O("p", "browse"); break; case 2: col4.N("p", "kiosk"); if (fxE.fxP().fyg()) { col4.r("restart", fxE.fxP().fyf()); } col4.O("p", "kiosk"); break; } } if (fxE.fxS()) { switch (fxE.fxR().type()) { case 0: col4.N("p", "sldAll"); col4.O("p", "sldAll"); break; case 1: col4.N("p", "sldRg"); arg fyh = fxE.fxR().fyh(); col4.r("st", fyh.start()); col4.r("end", fyh.end()); col4.O("p", "sldRg"); break; case 2: col4.N("p", "custShow"); col4.r("id", fxE.fxR().fyj()); col4.O("p", "custShow"); break; } } if (fxE.fxU()) { col4.N("p", "penClr"); azz.a(col4, fxE.fxT()); col4.O("p", "penClr"); } col4.O("p", "showPr"); } uto.w(col4); col4.O("p", "presentationPr"); col4.endDocument(); } utr utr = new utr(utp.kVG, uul.d(utp.ckx), utp.vHl.fuf()); if (utr.ckF != null) { col col5 = new col(uul.a(utr.ckF)); col5.startDocument(); col5.N("p", "viewPr"); col5.M("p", "http://schemas.openxmlformats.org/presentationml/2006/main"); col5.M("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); col5.M("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); if (utr.vKr.fHl()) { col5.J("lastView", uun.vLU.get(Integer.valueOf(utr.vKr.fHk()))); } if (utr.vKr.fHn()) { col5.i("showComments", utr.vKr.fHm()); } if (utr.vKr.fGX()) { tya fGW = utr.vKr.fGW(); col5.N("p", "normalViewPr"); if (fGW.fGG()) { col5.i("showOutlineIcons", fGW.fGF()); } if (fGW.fGI()) { col5.i("snapVertSplitter", fGW.fGH()); } if (fGW.fGK()) { col5.J("vertBarState", uun.vLV.get(Integer.valueOf(fGW.fGJ()))); } if (fGW.fGC()) { col5.J("horzBarState", uun.vLV.get(Integer.valueOf(fGW.fGB()))); } if (fGW.fGE()) { col5.i("preferSingleView", fGW.fGD()); } utr.a(col5, fGW.fGx(), "p", "restoredLeft"); utr.a(col5, fGW.fGz(), "p", "restoredTop"); col5.O("p", "normalViewPr"); } col5.N("p", "slideViewPr"); utr.a(col5, utr.vKr.fGY(), "p", "cSldViewPr"); col5.O("p", "slideViewPr"); utr.B(col5); if (utr.vKr.fHd()) { col5.N("p", "notesTextViewPr"); utr.a(col5, utr.vKr.fHc(), "p", "cViewPr"); col5.O("p", "notesTextViewPr"); } if (utr.vKr.fHf()) { tyc fHe = utr.vKr.fHe(); col5.N("p", "sorterViewPr"); if (fHe.fGV()) { col5.i("showFormatting", fHe.fGU()); } utr.a(col5, fHe.fGb(), "p", "cViewPr"); col5.O("p", "sorterViewPr"); } if (utr.vKr.fHh()) { col5.N("p", "notesViewPr"); utr.a(col5, utr.vKr.fHg(), "p", "cSldViewPr"); col5.O("p", "notesViewPr"); } bba.a(col5, utr.vKr.fHi(), "p", "gridSpacing"); col5.O("p", "viewPr"); col5.endDocument(); } if (utp.vHl.fum()) { new utn(utp.kVG, uul.e(utp.ckx)).np(); } ArrayList<String> ePz = utp.kVG.ePz(); if (ePz != null && ePz.size() > 0) { utu utu = new utu(ePz, uul.f(utp.ckx)); if (!(utu.ckF == null || utu.mItems == null || utu.mItems.isEmpty())) { cnc.a(utu.ckF, utu.mItems.get(0)); } } ArrayList<String> ePA = utp.kVG.ePA(); if (ePA != null && ePA.size() > 0) { utv utv = new utv(ePA, uul.g(utp.ckx)); if (!(utv.ckF == null || utv.vMu == null || utv.vMu.isEmpty())) { cnc.a(utv.ckF, utv.vMu.get(0)); } } tsn fof = utp.kVG.fof(); if (fof != null) { new uuk(utp.kVG, utp.ckx, fof).np(); } utp.brv.nq(); tvq P = tvq.P(kmoPresentation.Jy()); tvx fwQ = P.fuh().fwQ(); cln apH = clr.apH(); if (!(apH == null || fwQ == null)) { apH.cjL = fwQ.fwm(); apH.cjM = fwQ.foj(); apH.cjP = fwQ.fvv(); apH.cjO = fwQ.fvt(); } tvy fwS = P.fuh().fwS(); clp apI = clr.apI(); if (!(apI == null || fwS == null)) { apI.cjY = fwS.VN(); String fww = fwS.fww(); if (fww == null || fww.length() <= 0) { fww = Platform.getUserName(); } apI.cka = fww; apI.ckc = fwS.fwG(); String fwu = fwS.fwu(); if (fwu == null || fwu.length() == 0) { apI.ckd = new Date(); } else { apI.ckd = cld.fS(fwu); } apI.cke = new Date(); } if (!(kmoPresentation.uTD == null || (apJ = clr.apJ()) == null || (str2 = kmoPresentation.uTD) == null)) { cnc.a(apJ, str2); } clr.close(); byte[] bArr = new byte[8]; try { fileInputStream = new FileInputStream(absolutePath); try { fileInputStream.read(bArr); if (!new tit().x(bArr)) { throw new IOException("File format error!"); } vpf.closeStream(fileInputStream); a(kmoPresentation, absolutePath, uum); fjX = new File(str); alk.b(fjX, fjX); if (fjX.exists()) { fjX.delete(); } } catch (Throwable th) { th = th; vpf.closeStream(fileInputStream); throw th; } } catch (Throwable th2) { th = th2; fileInputStream = null; vpf.closeStream(fileInputStream); throw th; } } catch (Throwable th3) { th = th3; if (clr != null) { } throw th; } } catch (Throwable th4) { th = th4; clr = null; if (clr != null) { clr.close(); } throw th; } } finally { if (fjX.exists()) { fjX.delete(); } } } } private static void a(KmoPresentation kmoPresentation, String str, uum uum) throws IOException { String str2 = kmoPresentation.uTu.bsm; if (str2 != null) { bcf bcf = new bcf(); bcf.setOpenPassword(str2); File file = new File(str); File fjX = tiq.fjX(); File fjX2 = tiq.fjX(); try { bcf.a(file, fjX, fjX2.getAbsolutePath()); if (file.exists()) { file.delete(); } fjX.renameTo(file); if (uum.vNe) { uum.vNf += 45.0d; uum.vNd.ajp((int) uum.vNf); } } finally { if (fjX2.exists()) { fjX2.delete(); } if (fjX.exists()) { fjX.delete(); } } } } }